package offer_test_20;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

//题目描述：一个二维数组，每一行从左到右递增，每一列从上到下递增．输入一个二维数组和一个整数，判断数组中是否含有该整数。
public class three_SearchInArray {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String firstline = br.readLine();
		String[] info = firstline.split(" ");
		int length = Integer.parseInt(info[0]);
		int width = Integer.parseInt(info[1]);
		int[][] array = new int[length][width];
		String str;
		for (int i = 0; i < length; i++) {
			str = br.readLine();
			String[] temp = str.split(" ");
			for (int j = 0; j < width; j++) {
				array[i][j] = Integer.parseInt(temp[j]);
			}
		}
		System.out.println(Arrays.deepToString(array));
		int num = Integer.parseInt(br.readLine().trim());
		System.out.println(num);
		br.close();
		if (num > array[length - 1][width - 1]) {
			System.out.println("no");
			System.exit(0);
		}
		int n_length = 0;
		int n_width = width - 1;
		while (n_length < length && n_width >= 0) {
			if (num > array[n_length][n_width]) {
				n_length++;
				continue;
			}
			if (num < array[n_length][n_width]) {
				n_width--;
				continue;
			}
			if (num == array[n_length][n_width]) {
				System.out.println("yes");
				System.exit(0);
			}
		}
		System.out.println("no");
		System.exit(0);
	}
}
